//
//  BaseMyMateViewController.m
//  TQY
//
//  Created by 甘世清 on 2024/10/9.
//

#import "BaseMyMateViewController.h"
#import "MyMateListViewController.h"
#import "MateAddListViewController.h"

@interface BaseMyMateViewController ()
@property (nonatomic , strong)MyMateListViewController * myListVC;
@property (nonatomic , strong)MateAddListViewController * addListVC;
@end

@implementation BaseMyMateViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self SQ_UIViewForSelfView];
    SQCustomButton * rightBtn2 = [[SQCustomButton alloc]initType:SQCustomButtonLeftImageType imageSize:CGSizeMake(14, 14) midmargin:0];
    rightBtn2.image = SQGetImage(@"back_icon");
    [self.view addSubview:rightBtn2];
    [rightBtn2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.tabBar);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
        make.left.equalTo(self.view);
    }];
    WS(weakSelf);
    [rightBtn2 setTouchBlock:^(SQCustomButton * _Nonnull button) {
        [weakSelf.navigationController popViewControllerAnimated:YES];
    }];
}

- (void)SQ_UIViewForSelfView{
    
    UIImageView * bgImageView = [[UIImageView alloc]init];
    bgImageView.image = SQGetImage(@"二级背景");
    [self.view addSubview:bgImageView];
    [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    self.tabContentView.backgroundColor = UIColor.clearColor;
    self.tabBar.backgroundColor = UIColor.clearColor;
    self.tabBar.leadingSpace = 10;
    self.tabBar.trailingSpace = 10;
    self.tabBar.indicatorColor  = SQColor3DA59D;
    [self.tabBar setIndicatorWidth:40 marginTop:42 marginBottom:6 tapSwitchAnimated:YES];
    [self setTabBarFrame:CGRectMake(80, TopHeight-50, SCREEN_WIDETH-160,50)
        contentViewFrame:CGRectMake(0, TopHeight, SCREEN_WIDETH, SCREEN_HEIGHT-TopHeight)];
    self.tabBar.itemTitleFont = FONT_SEMIBOLD(18);
    self.tabBar.itemTitleColor = SQColor(@"#999999");
    self.tabBar.itemTitleSelectedColor = SQColor3DA59D;
    [self.tabContentView setContentScrollEnabled:YES tapSwitchAnimated:YES];
    self.tabContentView.loadViewOfChildContollerWhileAppear = YES;
    
    self.viewControllers = [[NSMutableArray alloc]initWithObjects:self.myListVC,self.addListVC, nil];
    [self.view sendSubviewToBack:bgImageView];
}
- (MyMateListViewController *)myListVC{
    if (!_myListVC) {
        _myListVC = [[MyMateListViewController alloc]init];
//        _homeVC.yp_tabItemImage = SQGetImage(@"图标-未选中-4");
//        _homeVC.yp_tabItemSelectedImage = SQGetImage(@"图标-选中-4");
        _myListVC.yp_tabItemTitle = SQNSLocalString(@"我发布的");
    }
    return _myListVC;
}
- (MateAddListViewController *)addListVC{
    if (!_addListVC) {
        _addListVC = [[MateAddListViewController alloc]init];
//        _copyVC.yp_tabItemImage = SQGetImage(@"图标-未选中");
//        _copyVC.yp_tabItemSelectedImage = SQGetImage(@"图标-选中");
        _addListVC.yp_tabItemTitle = SQNSLocalString(@"我参与的");
    }
    return _addListVC;
}

@end
